[gnwrapper] Support KeyboardInterrupt on Google Colab
gym.wrappers.Monitor and adds usuful features (e.g. starting virtual display automatically, showing videos on notebook).
Google Colaboratory allows users to stop a running cell by clicking a button. Internally,
KeyboardInterrupt is emitted to stop program.
Unfortunately, this crashed notebook kernel with a following error message after running any cells interecting virtual display;
XIO: fatal IO error 0 (Success) on X server ":0"
This happens when Xvfb stops incorrectly (and as far as I know, we cannot stop Xvfb “correctly” with OpenAI Gym). I needed to prevent Xvfb termination.
After long struggling, I found a StackOverflow answer which allowed subprocess to ignore signals from parent process.
By hacking, subprocess for virtual display ignores parent signal. Now, gnwrapper version 1.2.4 can accept Google Colaboratory stop button.